package cn.stylefeng.guns.modular.storage.service;

import java.util.List;

import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.web.multipart.MultipartFile;

import com.baomidou.mybatisplus.extension.service.IService;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.inventory.model.params.MoveDiskDetailedParam;
import cn.stylefeng.guns.modular.order.entity.OrderPut;
import cn.stylefeng.guns.modular.pandian.model.params.PandianChoupanDetailedParam;
import cn.stylefeng.guns.modular.pandian.model.params.PandianJihuaDetailedParam;
import cn.stylefeng.guns.modular.storage.entity.Kfgoods;
import cn.stylefeng.guns.modular.storage.entity.StoragePutSingle;
import cn.stylefeng.guns.modular.storage.entity.StorageStock;
import cn.stylefeng.guns.modular.storage.model.params.StorageOutDetailedParam;
import cn.stylefeng.guns.modular.storage.model.params.StorageStockParam;
import cn.stylefeng.guns.modular.storage.model.result.StoragePutSingleResult;
import cn.stylefeng.guns.modular.storage.model.result.StorageStockResult;
import cn.stylefeng.guns.sys.modular.system.entity.User;
import cn.stylefeng.roses.core.reqres.response.ResponseData;

/**
 * 库存表 服务类
 */
public interface StorageStockService extends IService<StorageStock> {

	/**
	 * 新增
	 */
	void add(StorageStockParam param);

	/**
	 * 删除
	 */
	void delete(StorageStockParam param);

	/**
	 * 更新
	 */
	void update(StorageStockParam param);

	/**
	 * 查询单条数据，Specification模式
	 */
	StorageStockResult findBySpec(StorageStockParam param);

	StorageStockResult findById(Integer id);

	/**
	 * 查询列表，Specification模式
	 */
	List<StorageStockResult> findListBySpec(StorageStockParam param, Long operateId);

	List<StorageStockResult> findExportToExcelBySpec(StorageStockParam param, Long operateId);

	/**
	 * 查询分页数据，Specification模式
	 */
	LayuiPageInfo findPageBySpec(StorageStockParam param, String condition);

	/**
	 * 批量新增
	 *
	 * @param
	 */
	void batchAdd(List<StoragePutSingle> ulist);

	/**
	 * 批量保存list
	 *
	 * @param
	 */
	boolean batchAddList(List<StorageStockParam> ssPlist);


	List<StorageStockResult> finByOnlyOne(StorageStockParam sp);

	/**
	 * 批量更新
	 *
	 * @param
	 * @return
	 */
	boolean updateBatchList(List<StorageStock> splist);

	/**
	 * 通过托盘编号，状态list 查询
	 *
	 * @param
	 * @return
	 */
	List<StorageStockResult> findListByparamList(List<StorageStockParam> ssrlist);

	/**
	 * 查询商品总量，体积总量
	 *
	 * @param
	 * @return
	 */
	StorageStockResult findTotalBySpec(StorageStockParam storageStockParam, Long operateId);

	/**
	 * 查询商品数量 前三
	 *
	 * @param
	 * @return
	 */
	List<StorageStockResult> findGoodsProportion(StorageStockParam storageStockParam);

	/**
	 * 查询品类总量
	 *
	 * @param
	 * @return
	 */
	StorageStockResult findTotalgoodsTypeBySpec(StorageStockParam storageStockParam, Long operateId);

	/**
	 * 查询商品数量
	 *
	 * @param storageStockParam
	 * @return
	 */
	LayuiPageInfo findGoodsListBySpec(StorageStockParam storageStockParam);

	/**
	 * 根据positionId查询商品
	 *
	 * @param
	 * @return
	 */
	List<StorageStockResult> findGoodsList(StorageStockParam storageStockParam, Long operateId);

	/**
	 * 根据positionId,goodsId查询托盘
	 *
	 * @param
	 * @return
	 */
	List<StorageStockResult> findTrayList(StorageStockParam storageStockParam);

	/**
	 * 查询库区商品总数.体积方法：
	 *
	 * @param
	 * @return
	 */
	List<StorageStockResult> totalGoodsVolumeList(StorageStockParam storageStockParam, Long operateId);

	StorageStockResult findByTrayId(StorageStockParam storageStockParam);

	StorageStockResult findByTrayIdall(StorageStockParam storageStockParam);

	/**
	 * APP 定盘 查询整体库存
	 *
	 * @param
	 * @return
	 */
	StorageStockResult findSumBySpec(StorageStockParam ssp);

	/**
	 * APP 定盘 查询商品列表
	 *
	 * @return
	 */
	LayuiPageInfo findPageGroupByGoodsIdBySpec(StorageStockParam param, Long diskId, String condition);

	/**
	 * APP 定盘 查询商品 分布详情
	 *
	 * @return
	 */
	LayuiPageInfo findPageDetailedBySpec(StorageStockParam param);

	StorageStockResult findFixedTotal(StorageStockParam ssp);

	StorageStockResult findTotalBySpecms(StorageStockParam storageStockParam, Long operateId);

	LayuiPageInfo findGoodsListBySpecms(StorageStockParam storageStockParam);

	List<StorageStockResult> moveQueryGoods(StorageStockParam param, Long operateId);

	List<StorageStockResult> findDetailedBySpec(StorageStockParam param);

	/**
	 * Web 库存监控
	 *
	 * @param storageStockParam
	 * @param startPutTime
	 * @param endPutTime
	 * @param startSingleTime
	 * @param endSinglePutTime
	 * @return
	 */
	LayuiPageInfo findStockPageBySpec(StorageStockParam storageStockParam, String startPutTime, String endPutTime, String startSingleTime, String endSinglePutTime, Long operateId);

	StorageStockResult findByGoods(StorageStockParam stockParam, Long operateId);

	/**
	 * 校验库位是否有两种商品
	 * 库存表中在库，未入
	 *
	 * @param param
	 * @return
	 */
	List<StorageStockResult> checkPositionGoodsNum(StorageStockParam param);

	int findTrayListRecommend(StorageStockParam param);

	/**
	 * 矫正库存
	 *
	 * @param moveDiskDetailedParam
	 */
	boolean correct(MoveDiskDetailedParam moveDiskDetailedParam);

	/**
	 * 拣货
	 * 修改库位
	 *
	 * @param param
	 */
	String modifyStorehouse(StorageOutDetailedParam param);

	/**
	 * 匹配库位
	 *
	 * @param detailedParam
	 */
	String matching(StorageOutDetailedParam detailedParam);

	List<StorageStockResult> findListBySpecandssss(StorageStockParam param);

	StorageStockResult sumbysqzkk(StorageStockParam stockParam);

	ResponseData batchImport(String fileName, MultipartFile file, StorageStockParam storageStockParam, ResponseData data) throws Exception;

	List<StorageStockResult> moveDiskFindGoodsList(StorageStockParam storageStockParam, Long operateId);

	void batchAddNew(List<StoragePutSingle> ulist, User user);

	void batchAddNewNew(List<StoragePutSingleResult> ulist, User user);

	List<StorageStockResult> findGoodsProportionNew(StorageStockParam storageStockParam, Long operateId);

	List<StorageStockResult> findGoodsListBySpecNew(StorageStockParam storageStockParam, Long operateId);

	List<StorageStockResult> findGoodsListBySpecmsNew(StorageStockParam storageStockParam, Long operateId);

	boolean correctNew(MoveDiskDetailedParam ddp, User user);

	List<StorageStockResult> moveQueryGoodsNEW(StorageStockParam storageStockParam);

	List<StorageStockResult> sumGoods(StorageStockParam storageStockParam);

	StorageStockResult sumGoodsZongliang(StorageStockParam storageStockParam);

	Integer baozhiqiCount(StorageStockParam storageStockParam);

	Integer baozhiqi2Count(StorageStockParam storageStockParam);

	Integer baozhiqi1Count(StorageStockParam storageStockParam);

	Integer baozhiqiGuoqiCount(StorageStockParam storageStockParam);

	LayuiPageInfo findStockPageBySpecGoods(StorageStockParam storageStockParam, Long operateId);

	LayuiPageInfo findStockPageBySpecProducetime(StorageStockParam storageStockParam, Long operateId);

	List<StorageStockResult> findshishikucun(StorageStockParam storageStockParam, String currentDate, Long operateId);

	List<Kfgoods> findkfgoods(StorageStockParam storageStockParam);

	List<StorageStockResult> findListBySpec2(StorageStockParam storageStockParam, Long operateId);

	StorageStockResult findBySpec2(StorageStockParam sparam3);

	boolean correctNewChouPan(PandianChoupanDetailedParam ddp, User user);

	StorageStockResult findDongzuoByPositionId(StorageStockParam storageStockParam);

	List<StorageStockResult> findPanDianPositionListBySpec(StorageStockParam storageStockParam, Long userId,
														   Long diskId);

	StorageStockResult findPanDianPositionBySpec(StorageStockParam storageStockParam, Long userId, Long diskId);

	List<StorageStockResult> findPanDianTrayListBySpec(StorageStockParam storageStockParam, Long userId, Long diskId);

	List<StorageStockResult> findPanDianGoodsListBySpec(StorageStockParam storageStockParam, Long userId, Long diskId);

	boolean correctJhua(PandianJihuaDetailedParam pandianJihuaDetailedParam, User user);

	List<StorageStockResult> moveDiskFindGoodsListChoupan(StorageStockParam storageStockParam, Long diskId, Long operateId);

	List<StorageStockResult> findListBySpecDongzuo(StorageStockParam ssp, Long operateId);

	LayuiPageInfo findStockPageBySpecGoodsChuzhi(StorageStockParam storageStockParam, Long operateId);

	List<StorageStockResult> findListGroupgoodsbatchs(StorageStockParam sp);

	void taskJob();

	List<StorageStockResult> findListSumBySpec(StorageStockParam sp);

	Integer addReturnId(StorageStockParam param2);

	/**
	 * 直接入库
	 *
	 * @param orderPut
	 * @return
	 */
	ResponseData putStridesAddStorageStock(OrderPut orderPut);

	List<StorageStockResult> finByOnlyOnePositionNumber(StorageStockParam sp);

	List<StorageStockResult> finByOnlyOneOrderByGoodsbatchs(StorageStockParam sp);

	void deleteBySpec(StorageStockParam param);

	LayuiPageInfo findStockPageBySpecPositionNumber(StorageStockParam param, Long operateId);

	LayuiPageInfo findGroupsStockPageBySpec(StorageStockParam storageStockParam, Long operateId);

	void updateBySpec(StorageStockParam storageStockParam);

	Workbook exportToExcel(StorageStockParam storageStockParam);

	StorageStockResult findKwShuBySpec(StorageStockParam param);

	StorageStockResult sumbyJhwsqzkk(StorageStockParam stockParam);

	String getKCCountByGoodsNumber(String detailedGoodscode, String positionType);

	String getDjhCountByGoodsNumber(String detailedGoodscode, Long deptId);

	LayuiPageInfo findStockPageBySpecNew(StorageStockParam storageStockParam, String startPutTime, String endPutTime, String startSingleTime, String endSinglePutTime, Long operateId);

	List<StorageStockResult> finByOnlyOnePositionNumber1(StorageStockParam storageOccupy);

	List<StorageStockResult> findListBySpec1(StorageStockParam storageStockParam, Long operateId);

	ResponseData storageLimitItems(User user, String positionNumber1, Long warehouseId, String goodsNo, String goodsNumber, String batchNumber);
}